<include file="Public:header" />
<script src="__PUBLIC__/js/PCASClass.js" type="text/javascript"></script>
<div class="container">
	<div class="page-header">
		<h4>{:L('SYSTEM_SETTING')}</h4>
	</div>
	<include file="Public:alert" />	
	<div class="tabbable">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:U('setting/defaultInfo')}">{:L('BASIC_SYSTEM_SETTING')}</a></li>
			<li><a href="{:U('setting/smtp')}">{:L('SMTP_SETTING')}</a></li>
			<li><a href="{:U('setting/fields')}">{:L('CUSTOMIZING_FIELDS_SETTING')}</a></li>		
			<li><a href="{:U('navigation/setting')}">{:L('SYSTEM_NAVIGATION_SETTING')}</a></li>
			<li><a href="{:U('setting/weixin')}">{:L('WHCHAT_SETTING')}</a></li>
		</ul>
		<div class="row">
			<form class="form-horizontal" enctype="multipart/form-data" action="{:U('setting/defaultInfo')}" method="post">
				<table class="span6 table">
					<thead>
						<tr>
							<th colspan="2">{:L('THE_DEFAULT_INFORMATION')}</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td class="tdleft">{:L('SYSTEM_NAME')}</td>  
							<td>
								<input name="name" id="name" type="text" value="{$defaultinfo.name}">
							</td>
						</tr>
						<tr>
							<td class="tdleft">{:L('SYSTEM_DESCRIBE')}</td>  
							<td>
								<input name="description" id="description" type="text" value="{$defaultinfo.description}">
							</td>
						</tr>
						<tr>
							<td class="tdleft">{:L('SYSTEM_LOGO')}</td>  
							<td>
								<input name="logo" type="file"> {:L('SUGGEST_SIZE')}
								<if condition="$defaultinfo['logo'] neq ''"><br/><img src="{$defaultinfo.logo}" style="width:50px;"/></if>
							</td>
						</tr>
						<tr>
							<td class="tdleft">{:L('THE_DEFAULT_AREA')}</td>  
							<td>
								<select id="state" name="state" class="input-medium"></select>
								<select id="city" name="city" class="input-medium"></select>
							</td>
						</tr>
						<tr>
							<th colspan="2">{:L('SECURITY_AND_DEBUGGING')}</th>
						</tr>
						<tr>
							<td class="tdleft">{:L('ALLOW_THE_UPLOAD_FILE_TYPE')}</td>  
							<td>
								<input name="allow_file_type" id="name" type="text" value="{$defaultinfo.allow_file_type}">
								<br/><span style="color:red;">{:L('USE_COMMAS_BETWEEN_TYPES')} </span>
							</td>
						</tr>
						<tr>
							<td class="tdleft">{:L('CLEAR_THE_CACHE')}</td>  
							<td>
								<input type="button" class="btn" id="clear" value="{:L('EMPTY')}"/>
							</td>
						</tr>
						<tr>
							<td class="tdleft">{:L('DEBUG_MODE')}</td>  
							<td>
								<input type="button" class="btn" id="opendebug" value="{:L('OPEN')}"/> &nbsp;
								<input type="button" class="btn" id="closedebug" value="{:L('CLOSE')}"/>
							</td>
						</tr>
						<tr>
							<th colspan="2">{:L('OTHER_SETTING')}</th>
						</tr>
						<tr>
							<td class="tdleft">{:L('THE_CONTRACT_TIME_TO_REMIND')}</td>  
							<td>
								{:L('AHEAD_OF_TIME')}<input type="text" style="width:50px;" name="contract_alert_time" value="{$defaultinfo['contract_alert_time']|default=30}"/>{:L('DAY')}
							</td>
						</tr>
						<tr>
							<td class="tdleft">{:L('CONTRACT_PREFIX')}</td>  
							<td>
								<input class="input-small" type="text" name="contract_custom" value="{$contract_custom|default='5k_crm'}"><font color="red">{:L('MODIFY_PREFIX')}
							</td>
						</tr>
						<tr>
							<td class="tdleft">{:L('TASK_ALLOCATION_MODE')}</td>
							<td>
								<input name="task_model" type="radio" <if condition="$defaultinfo.task_model != 2">checked="checked"</if> value="1"/>{:L('ALLOW_ONLY_ASSIGNED_TO_THE_LOWER')} &nbsp;  &nbsp; 
								<input <if condition="$defaultinfo.task_model == 2">checked="checked"</if>  name="task_model" type="radio" value="2"/>{:L('RANDOM_DISTRIBUTION')}
							</td>
						</tr>
						<tr>
							<td class="tdleft">{:L('CUSTOMER_POOL_RECOVERY_CYCLE')}</td>
							<td>
								<input class="input-small" type="text" id="customer_outdays" name="customer_outdays" value="{$customer_outdays}" size="5"/>{:L('DAY')}
							</td>
						</tr>
						<tr>
							<td class="tdleft">{:L('CUSTOMERS_RECEIVE_CYCLE')}</td>
							<td>
								<select name="customer_limit_condition" class="input-small">
									<option value="day" <if condition="'day' eq $customer_limit_condition">selected="selected"</if>>{:L('TODAY')}</option>
									<option value="week" <if condition="'week' eq $customer_limit_condition">selected="selected"</if>>{:L('THIS_WEEK')}</option>
									<option value="month" <if condition="'month' eq $customer_limit_condition">selected="selected"</if>>{:L('THIS_MONTH')}</option>
								</select>
								{:L('WITHIN_LIMITS_TO_RECEIVE')}
								<input class="input-small" type="text" id="customer_limit_counts" name="customer_limit_counts" value="{$customer_limit_counts}" size="5"/>{:L('CI')}
							</td>
						</tr>
						<tr>
							<td class="tdleft">{:L('LEADS_POOL_RECOVERY_CYCLE')}</td>
							<td>
								<input class="input-small" type="text" id="leads_outdays" name="leads_outdays" value="{$leads_outdays}" size="5"/>{:L('DAY')}
							</td>
						</tr>
						<tr>
							<td>&nbsp;</td>  
							<td>
								<input name="submit" class="btn btn-primary" type="submit" value="{:L('SAVE')}"/>
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div> <!-- End #main-content -->
</div>
<script type="text/javascript">
$(function(){
	new PCAS("state","city","{$defaultinfo.state}","{$defaultinfo.city}");
	$('#clear').click(function(){
		if(confirm('{:L('SURE_YOU_WANT_TO_EMPTY_THE_CACHE')}')){
			$.get("{:U('setting/clearcache')}", function(result){
				if(result.status == 1){
					alert('{:L('HAVE_TO_EMPTY_THE_CACHE')}');
				}else{
					alert('{:L('EMPTY_THE_CACHE_FAUILRE')}');
				}
			});
		}
	});
	$('#opendebug').click(function(){
		$.get("{:U('setting/opendebug')}", function(result){
			if(result.status == 1){
				alert('{:L('DEBUG_MODE_HAS_BEEN_OPEN')}');
			}else if(result.status == 2){
				alert('{:L('CONFIGURATION_FILE_NOT_WRITE_PERMISSIONS')}');
			}
		});
	});
	$('#closedebug').click(function(){
		$.get("{:U('setting/closedebug')}", function(result){
			if(result.status == 1){
				alert('{:L('DEBUG_MODE_HAS_BEEN_CLOSE')}');
			}else if(result.status == 2){
				alert('{:L('CONFIGURATION_FILE_NOT_WRITE_PERMISSIONS')}');
			}
		});
	});
});
</script>
<include file="Public:footer" />	